package com.woniuxy.springbootthymeleaf.filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * @author linke
 * @version 1.0
 * @className: CustomFilter
 * @description: 设置字符编码集 过滤器
 * @date 2021/11/17 1:22
 */
public class CustomFilter implements Filter {

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        System.out.println("过滤器启动");
        request.setCharacterEncoding("UTF-8");
        response.setCharacterEncoding("UTF-8");
        chain.doFilter(request,response);
    }
}
